package cn.yza.设计模式.单例模式;

import java.util.concurrent.atomic.AtomicLong;

/** 枚举的单例
 * @author Honglixi
 * @create 2021-10-25 14:21
 */
public enum SingletonTest05 {
    INSTANCE,
    ;
    private AtomicLong id = new AtomicLong(0);

    public long getId() {
        return id.incrementAndGet();
    }


//    public static void main(String[] args) {
//        long instance = SingletonTest05.INSTANCE.getId();
//        System.out.println(instance);
//    }
}
